
<php>$submenus=(array)json_decode($SUBMENU_CONFIG);</php>

<php>function getsubmenu($submenus){</php>
<ul class="nav nav-list">
	<php>foreach($submenus as $menu){ </php>
	<li>
	<php>if(empty($menu->items)){</php>
	<a href="javascript:openapp('{$menu:url}','{$menu:id}','{$menu:name}');">
		<i class="fa fa-{$menu:icon|default='desktop'}"></i>
		<span class="menu-text">{$menu:name}</span>
	</a>
	<php>}else{</php>
	<a href="#" class="dropdown-toggle">
		<i class="fa fa-{$menu:icon|default='desktop'}"></i>
		<span class="menu-text">{$menu:name}</span>
		<b class="arrow fa fa-angle-down"></b>
	</a>

	<php>getsubmenu1((array)$menu->items)</php>

	<php>}</php>
</li>
<php>}</php>
</ul>
<php>}</php>

<php>function getsubmenu1($submenus){</php>
<ul class="submenu">
	<php>foreach($submenus as $menu){</php>
	<li>
	<php>if(empty($menu->items)){</php>
	<a href="javascript:openapp('{$menu:url}','{$menu:id}','{$menu:name}');">
		<i class="fa fa-angle-double-right"></i>
		<span class="menu-text">{$menu:name}</span>
	</a>
	<php>}else{</php>
	<a href="#" class="dropdown-toggle">
		<i class="fa fa-angle-double-right"></i>
		<span class="menu-text">{$menu:name}</span>
		<b class="arrow fa fa-angle-down"></b>
	</a>
	<php>getsubmenu2((array)$menu->items)</php>
	<php>}</php>
</li>
<php>}</php>
</ul>	
<php>}</php>

<php>function getsubmenu2($submenus){</php>
<ul  class="submenu">
	<php>foreach($submenus as $menu){</php>
	<li>
		<a href="javascript:openapp('{$menu:url}','{$menu:id}','{$menu:name}');">
			<i class="fa fa-leaf"></i>
			<span class="menu-text">{$menu:name}</span>
		</a>
	</li>
	<php>}</php>
</ul>
<php>}</php>

{:getsubmenu($submenus)}
